USE [master]
GO
/****** Object:  Database [pavii-bebidas]    Script Date: 10/05/2014 08:28:46 p.m. ******/
CREATE DATABASE [pavii-bebidas] ON  PRIMARY 
( NAME = N'pavii-bebidas', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL11.SQLEXPRESS\MSSQL\DATA\pavii-bebidas.mdf' , SIZE = 5120KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
 LOG ON 
( NAME = N'pavii-bebidas_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL11.SQLEXPRESS\MSSQL\DATA\pavii-bebidas_log.ldf' , SIZE = 2048KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)
GO
IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [pavii-bebidas].[dbo].[sp_fulltext_database] @action = 'enable'
end
GO
ALTER DATABASE [pavii-bebidas] SET ANSI_NULL_DEFAULT OFF 
GO
ALTER DATABASE [pavii-bebidas] SET ANSI_NULLS OFF 
GO
ALTER DATABASE [pavii-bebidas] SET ANSI_PADDING OFF 
GO
ALTER DATABASE [pavii-bebidas] SET ANSI_WARNINGS OFF 
GO
ALTER DATABASE [pavii-bebidas] SET ARITHABORT OFF 
GO
ALTER DATABASE [pavii-bebidas] SET AUTO_CLOSE OFF 
GO
ALTER DATABASE [pavii-bebidas] SET AUTO_CREATE_STATISTICS ON 
GO
ALTER DATABASE [pavii-bebidas] SET AUTO_SHRINK OFF 
GO
ALTER DATABASE [pavii-bebidas] SET AUTO_UPDATE_STATISTICS ON 
GO
ALTER DATABASE [pavii-bebidas] SET CURSOR_CLOSE_ON_COMMIT OFF 
GO
ALTER DATABASE [pavii-bebidas] SET CURSOR_DEFAULT  GLOBAL 
GO
ALTER DATABASE [pavii-bebidas] SET CONCAT_NULL_YIELDS_NULL OFF 
GO
ALTER DATABASE [pavii-bebidas] SET NUMERIC_ROUNDABORT OFF 
GO
ALTER DATABASE [pavii-bebidas] SET QUOTED_IDENTIFIER OFF 
GO
ALTER DATABASE [pavii-bebidas] SET RECURSIVE_TRIGGERS OFF 
GO
ALTER DATABASE [pavii-bebidas] SET  DISABLE_BROKER 
GO
ALTER DATABASE [pavii-bebidas] SET AUTO_UPDATE_STATISTICS_ASYNC OFF 
GO
ALTER DATABASE [pavii-bebidas] SET DATE_CORRELATION_OPTIMIZATION OFF 
GO
ALTER DATABASE [pavii-bebidas] SET TRUSTWORTHY OFF 
GO
ALTER DATABASE [pavii-bebidas] SET ALLOW_SNAPSHOT_ISOLATION OFF 
GO
ALTER DATABASE [pavii-bebidas] SET PARAMETERIZATION SIMPLE 
GO
ALTER DATABASE [pavii-bebidas] SET READ_COMMITTED_SNAPSHOT OFF 
GO
ALTER DATABASE [pavii-bebidas] SET HONOR_BROKER_PRIORITY OFF 
GO
ALTER DATABASE [pavii-bebidas] SET RECOVERY SIMPLE 
GO
ALTER DATABASE [pavii-bebidas] SET  MULTI_USER 
GO
ALTER DATABASE [pavii-bebidas] SET PAGE_VERIFY CHECKSUM  
GO
ALTER DATABASE [pavii-bebidas] SET DB_CHAINING OFF 
GO
USE [pavii-bebidas]
GO
/****** Object:  Table [dbo].[Barrio]    Script Date: 10/05/2014 08:28:46 p.m. ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Barrio](
	[idBarrio] [int] IDENTITY(1,1) NOT NULL,
	[nombre] [varchar](50) NOT NULL,
	[idLocalidad] [int] NOT NULL,
 CONSTRAINT [PK_Barrio] PRIMARY KEY CLUSTERED 
(
	[idBarrio] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Categoria]    Script Date: 10/05/2014 08:28:46 p.m. ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Categoria](
	[idCategoria] [int] IDENTITY(1,1) NOT NULL,
	[nombre] [varchar](50) NOT NULL,
 CONSTRAINT [PK_Categoria] PRIMARY KEY CLUSTERED 
(
	[idCategoria] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Cliente]    Script Date: 10/05/2014 08:28:46 p.m. ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Cliente](
	[idCliente] [int] IDENTITY(1,1) NOT NULL,
	[nombre] [varchar](50) NOT NULL,
	[apellido] [varchar](50) NOT NULL,
	[idTipoDocumento] [int] NOT NULL,
	[nroDocumento] [int] NOT NULL,
	[idDomicilio] [int] NOT NULL,
	[telFijo] [int] NULL,
	[telCelular] [int] NULL,
	[email] [varchar](50) NULL,
 CONSTRAINT [PK_Cliente] PRIMARY KEY CLUSTERED 
(
	[idCliente] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Detalle_Factura]    Script Date: 10/05/2014 08:28:46 p.m. ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Detalle_Factura](
	[idDetalleFactura] [int] IDENTITY(1,1) NOT NULL,
	[idFactura] [int] NOT NULL,
	[idProducto] [int] NOT NULL,
	[cantidad] [int] NOT NULL,
	[precioUnitario] [float] NOT NULL,
 CONSTRAINT [PK_Detalle_Factura] PRIMARY KEY CLUSTERED 
(
	[idDetalleFactura] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[Detalle_Itinerario]    Script Date: 10/05/2014 08:28:46 p.m. ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Detalle_Itinerario](
	[idDetalleItinerario] [int] IDENTITY(1,1) NOT NULL,
	[idItinerario] [int] NOT NULL,
	[fechaHoraEntrega] [datetime] NULL,
	[entregado] [bit] NOT NULL,
	[observaciones] [varchar](2000) NULL,
 CONSTRAINT [PK_Detalle_Itinerario] PRIMARY KEY CLUSTERED 
(
	[idDetalleItinerario] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Domicilio]    Script Date: 10/05/2014 08:28:46 p.m. ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Domicilio](
	[idDomicilio] [int] IDENTITY(1,1) NOT NULL,
	[calle] [varchar](50) NOT NULL,
	[nro] [int] NOT NULL,
	[idBarrio] [int] NOT NULL,
 CONSTRAINT [PK_Domicilio] PRIMARY KEY CLUSTERED 
(
	[idDomicilio] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Estado_Factura]    Script Date: 10/05/2014 08:28:46 p.m. ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Estado_Factura](
	[idEstadoFactura] [int] IDENTITY(1,1) NOT NULL,
	[nombre] [varchar](50) NOT NULL,
 CONSTRAINT [PK_Estado_Factura] PRIMARY KEY CLUSTERED 
(
	[idEstadoFactura] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Factura]    Script Date: 10/05/2014 08:28:46 p.m. ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Factura](
	[idFactura] [int] IDENTITY(1,1) NOT NULL,
	[fechaEmision] [datetime] NOT NULL,
	[idCliente] [int] NOT NULL,
	[idEstadoFactura] [int] NOT NULL,
 CONSTRAINT [PK_Factura] PRIMARY KEY CLUSTERED 
(
	[idFactura] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[Itinerario_Reparto]    Script Date: 10/05/2014 08:28:46 p.m. ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Itinerario_Reparto](
	[idItinerario] [int] IDENTITY(1,1) NOT NULL,
	[nroCamionReparto] [int] NOT NULL,
	[fecha] [datetime] NOT NULL,
 CONSTRAINT [PK_Itinerario_Reparto] PRIMARY KEY CLUSTERED 
(
	[idItinerario] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[Localidad]    Script Date: 10/05/2014 08:28:46 p.m. ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Localidad](
	[idLocalidad] [int] IDENTITY(1,1) NOT NULL,
	[nombre] [varchar](50) NOT NULL,
	[idProvincia] [int] NULL,
 CONSTRAINT [PK_Localidad] PRIMARY KEY CLUSTERED 
(
	[idLocalidad] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Marca]    Script Date: 10/05/2014 08:28:46 p.m. ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Marca](
	[idMarca] [int] IDENTITY(1,1) NOT NULL,
	[nombre] [varchar](50) NOT NULL,
 CONSTRAINT [PK_Marca] PRIMARY KEY CLUSTERED 
(
	[idMarca] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Producto]    Script Date: 10/05/2014 08:28:46 p.m. ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Producto](
	[idProducto] [int] IDENTITY(1,1) NOT NULL,
	[nombre] [varchar](50) NOT NULL,
	[idMarca] [int] NOT NULL,
	[idCategoria] [int] NOT NULL,
	[tamanio] [float] NOT NULL,
	[idUnidadMedida] [int] NOT NULL,
	[precioUnitario] [float] NOT NULL,
	[stock] [int] NOT NULL,
	[fechaIngreso] [datetime] NOT NULL,
	[fechaBaja] [datetime] NULL,
 CONSTRAINT [PK_Producto] PRIMARY KEY CLUSTERED 
(
	[idProducto] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Provincia]    Script Date: 10/05/2014 08:28:46 p.m. ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Provincia](
	[idProvincia] [int] IDENTITY(1,1) NOT NULL,
	[nombre] [varchar](50) NOT NULL,
 CONSTRAINT [PK_Provincia] PRIMARY KEY CLUSTERED 
(
	[idProvincia] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Tipo_Documento]    Script Date: 10/05/2014 08:28:46 p.m. ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Tipo_Documento](
	[idTipoDoc] [int] IDENTITY(1,1) NOT NULL,
	[nombre] [varchar](50) NOT NULL,
 CONSTRAINT [PK_Tipo_Documento] PRIMARY KEY CLUSTERED 
(
	[idTipoDoc] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Unidad_Medida]    Script Date: 10/05/2014 08:28:46 p.m. ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Unidad_Medida](
	[idUnidadMedida] [int] IDENTITY(1,1) NOT NULL,
	[nombre] [varchar](50) NOT NULL,
 CONSTRAINT [PK_Unidad_Medida] PRIMARY KEY CLUSTERED 
(
	[idUnidadMedida] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
SET IDENTITY_INSERT [dbo].[Provincia] ON 

GO
INSERT [dbo].[Provincia] ([idProvincia], [nombre]) VALUES (1, N'Buenos Aires')
GO
INSERT [dbo].[Provincia] ([idProvincia], [nombre]) VALUES (2, N'Catamarca')
GO
INSERT [dbo].[Provincia] ([idProvincia], [nombre]) VALUES (3, N'Chaco')
GO
INSERT [dbo].[Provincia] ([idProvincia], [nombre]) VALUES (4, N'Chubut')
GO
INSERT [dbo].[Provincia] ([idProvincia], [nombre]) VALUES (5, N'Cordoba')
GO
INSERT [dbo].[Provincia] ([idProvincia], [nombre]) VALUES (6, N'Corrientes')
GO
INSERT [dbo].[Provincia] ([idProvincia], [nombre]) VALUES (7, N'Entre Rios')
GO
INSERT [dbo].[Provincia] ([idProvincia], [nombre]) VALUES (8, N'Formosa')
GO
INSERT [dbo].[Provincia] ([idProvincia], [nombre]) VALUES (9, N'Jujuy')
GO
INSERT [dbo].[Provincia] ([idProvincia], [nombre]) VALUES (10, N'La Pampa')
GO
INSERT [dbo].[Provincia] ([idProvincia], [nombre]) VALUES (11, N'La Rioja')
GO
INSERT [dbo].[Provincia] ([idProvincia], [nombre]) VALUES (12, N'Mendoza')
GO
INSERT [dbo].[Provincia] ([idProvincia], [nombre]) VALUES (13, N'Misiones')
GO
INSERT [dbo].[Provincia] ([idProvincia], [nombre]) VALUES (14, N'Neuquen')
GO
INSERT [dbo].[Provincia] ([idProvincia], [nombre]) VALUES (15, N'Rio Negro')
GO
INSERT [dbo].[Provincia] ([idProvincia], [nombre]) VALUES (16, N'Salta')
GO
INSERT [dbo].[Provincia] ([idProvincia], [nombre]) VALUES (17, N'San Juan')
GO
INSERT [dbo].[Provincia] ([idProvincia], [nombre]) VALUES (18, N'San Luis')
GO
INSERT [dbo].[Provincia] ([idProvincia], [nombre]) VALUES (19, N'Santa Cruz')
GO
INSERT [dbo].[Provincia] ([idProvincia], [nombre]) VALUES (20, N'Santa Fe')
GO
INSERT [dbo].[Provincia] ([idProvincia], [nombre]) VALUES (21, N'Santiago del Estero')
GO
INSERT [dbo].[Provincia] ([idProvincia], [nombre]) VALUES (22, N'Tierra del Fuego')
GO
INSERT [dbo].[Provincia] ([idProvincia], [nombre]) VALUES (23, N'Tucuman')
GO
INSERT [dbo].[Provincia] ([idProvincia], [nombre]) VALUES (24, N'Capital Federal')
GO
SET IDENTITY_INSERT [dbo].[Provincia] OFF
GO
SET IDENTITY_INSERT [dbo].[Tipo_Documento] ON 

GO
INSERT [dbo].[Tipo_Documento] ([idTipoDoc], [nombre]) VALUES (1, N'DNI')
GO
INSERT [dbo].[Tipo_Documento] ([idTipoDoc], [nombre]) VALUES (2, N'LE')
GO
INSERT [dbo].[Tipo_Documento] ([idTipoDoc], [nombre]) VALUES (3, N'LC')
GO
INSERT [dbo].[Tipo_Documento] ([idTipoDoc], [nombre]) VALUES (4, N'Pasaporte')
GO
SET IDENTITY_INSERT [dbo].[Tipo_Documento] OFF
GO
ALTER TABLE [dbo].[Itinerario_Reparto] ADD  CONSTRAINT [DF_Itinerario_Reparto_fecha]  DEFAULT (getdate()) FOR [fecha]
GO
ALTER TABLE [dbo].[Producto] ADD  CONSTRAINT [DF_Producto_fechaIngreso]  DEFAULT (getdate()) FOR [fechaIngreso]
GO
ALTER TABLE [dbo].[Barrio]  WITH CHECK ADD  CONSTRAINT [FK_Barrio_Localidad] FOREIGN KEY([idLocalidad])
REFERENCES [dbo].[Localidad] ([idLocalidad])
GO
ALTER TABLE [dbo].[Barrio] CHECK CONSTRAINT [FK_Barrio_Localidad]
GO
ALTER TABLE [dbo].[Cliente]  WITH CHECK ADD  CONSTRAINT [FK_Cliente_Domicilio] FOREIGN KEY([idDomicilio])
REFERENCES [dbo].[Domicilio] ([idDomicilio])
GO
ALTER TABLE [dbo].[Cliente] CHECK CONSTRAINT [FK_Cliente_Domicilio]
GO
ALTER TABLE [dbo].[Cliente]  WITH CHECK ADD  CONSTRAINT [FK_Cliente_Tipo_Documento] FOREIGN KEY([idTipoDocumento])
REFERENCES [dbo].[Tipo_Documento] ([idTipoDoc])
GO
ALTER TABLE [dbo].[Cliente] CHECK CONSTRAINT [FK_Cliente_Tipo_Documento]
GO
ALTER TABLE [dbo].[Detalle_Factura]  WITH CHECK ADD  CONSTRAINT [FK_Detalle_Factura_Factura] FOREIGN KEY([idFactura])
REFERENCES [dbo].[Factura] ([idFactura])
GO
ALTER TABLE [dbo].[Detalle_Factura] CHECK CONSTRAINT [FK_Detalle_Factura_Factura]
GO
ALTER TABLE [dbo].[Detalle_Factura]  WITH CHECK ADD  CONSTRAINT [FK_Detalle_Factura_Producto] FOREIGN KEY([idProducto])
REFERENCES [dbo].[Producto] ([idProducto])
GO
ALTER TABLE [dbo].[Detalle_Factura] CHECK CONSTRAINT [FK_Detalle_Factura_Producto]
GO
ALTER TABLE [dbo].[Detalle_Itinerario]  WITH CHECK ADD  CONSTRAINT [FK_Detalle_Itinerario_Itinerario_Reparto] FOREIGN KEY([idItinerario])
REFERENCES [dbo].[Itinerario_Reparto] ([idItinerario])
GO
ALTER TABLE [dbo].[Detalle_Itinerario] CHECK CONSTRAINT [FK_Detalle_Itinerario_Itinerario_Reparto]
GO
ALTER TABLE [dbo].[Domicilio]  WITH CHECK ADD  CONSTRAINT [FK_Domicilio_Barrio] FOREIGN KEY([idBarrio])
REFERENCES [dbo].[Barrio] ([idBarrio])
GO
ALTER TABLE [dbo].[Domicilio] CHECK CONSTRAINT [FK_Domicilio_Barrio]
GO
ALTER TABLE [dbo].[Factura]  WITH CHECK ADD  CONSTRAINT [FK_Factura_Estado_Factura] FOREIGN KEY([idEstadoFactura])
REFERENCES [dbo].[Estado_Factura] ([idEstadoFactura])
GO
ALTER TABLE [dbo].[Factura] CHECK CONSTRAINT [FK_Factura_Estado_Factura]
GO
ALTER TABLE [dbo].[Localidad]  WITH CHECK ADD  CONSTRAINT [FK_Localidad_Provincia] FOREIGN KEY([idProvincia])
REFERENCES [dbo].[Provincia] ([idProvincia])
GO
ALTER TABLE [dbo].[Localidad] CHECK CONSTRAINT [FK_Localidad_Provincia]
GO
ALTER TABLE [dbo].[Producto]  WITH CHECK ADD  CONSTRAINT [FK_Producto_Categoria] FOREIGN KEY([idCategoria])
REFERENCES [dbo].[Categoria] ([idCategoria])
GO
ALTER TABLE [dbo].[Producto] CHECK CONSTRAINT [FK_Producto_Categoria]
GO
ALTER TABLE [dbo].[Producto]  WITH CHECK ADD  CONSTRAINT [FK_Producto_Marca] FOREIGN KEY([idMarca])
REFERENCES [dbo].[Marca] ([idMarca])
GO
ALTER TABLE [dbo].[Producto] CHECK CONSTRAINT [FK_Producto_Marca]
GO
ALTER TABLE [dbo].[Producto]  WITH CHECK ADD  CONSTRAINT [FK_Producto_Unidad_Medida] FOREIGN KEY([idUnidadMedida])
REFERENCES [dbo].[Unidad_Medida] ([idUnidadMedida])
GO
ALTER TABLE [dbo].[Producto] CHECK CONSTRAINT [FK_Producto_Unidad_Medida]
GO
USE [master]
GO
ALTER DATABASE [pavii-bebidas] SET  READ_WRITE 
GO
